import React from 'react'
import './Commonts.less'
import tou from '../../assets/images/头像.png'
import friends from '../../assets/images/friends.png'
import Scroll from '../../baseUI/scroll/index.jsx'
import { forceCheck } from 'react-lazyload'
import Commontsitem from './Commontsitem/Commontsitem'


const addone = () => {

}
const Commonts = (props) => {
    console.log(props, 'commonts----props');
    // const { commentsindex, commonts } = props
    const { commonts, commontsindex } = props
    // console.log(commonts[commontsindex], 'commonts-------------------');
    console.log(commontsindex, 'commontsindex的值');

    const handleOnclick = () => {
        // popup 组件显示与否
        // console.log(showPopup,'2222222222222222222222');
        setShowPopup(!showPopup)
    }
    // 上拉加载更多
    const handlePullUp = () => {
        console.log('上拉加载更多');
        // setPage(page + 1)
    }
    // 下拉刷新
    const handlePullDown = () => {
        console.log('下拉刷新');
    }
    return (
        <>
       
        <div className='scroll-con'>
            <Scroll
                direction={"vertical"}
                refresh={false}
                onScroll={
                    (e) => {
                        forceCheck()
                        // console.log(e);
                        // console.log(e.y);
                        // if (e.y < -100) {
                        //     setDisplay(true)
                        // } else {
                        //     setDisplay(false)
                        // }
                    }
                    // forceCheck()

                }
                pullUp={handlePullUp}
                pullDown={handlePullDown} >
                <div>
                    {
                        commontsindex == 1 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) :
                         (
                            commontsindex == 2 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) : (
                                commontsindex == 3 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) : (
                                    commontsindex == 4 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) : (
                                        commontsindex == 5 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) : (
                                            commontsindex == 6 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) : (
                                                commontsindex == 7 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) : (
                                                    commontsindex == 8 ? (<Commontsitem commonts={commonts} commontsindex={commontsindex} />) : []
                                                )
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    }

                </div>
            </Scroll>


        </div>
        </>
    )
}

export default Commonts